#ifndef __TDP2_RC5_BLOCKSORT_HPP__
#define __TDP2_RC5_BLOCKSORT_HPP__

#include "tdp2.hpp"

namespace TDP
{
	namespace Compression
	{
		namespace BlockSort
		{
			static const int SortSpaceRadix_k = 2;
			static const int SortSpaceQSort_k = 12;
			static const int SortSpaceShell_k = 18;
			static const int SortSpaceOvershoot_k = (SortSpaceRadix_k + SortSpaceQSort_k + SortSpaceShell_k + 2);

			// Sorts an array >0 size
			// arr2 must have nblock+SortSpaceOvershoot_k elements, holds initial block values reinterpreted as byte
			// arr1 must have nblock elements

			// End result:
			// arr1 holds sorted order
			void Sort(UInt32 *ftab, Int32 nblock, UInt32 *arr1, UInt32 *arr2, Int32 wfact = 30);
		}
	}
}

#endif